package imse.team1.orders.ws;


import imse.team1.orders.data.*;

/**
 * @author Eugen, 6/17/12 3:26 PM
 */
public class OrderPlacementServiceSkeleton implements OrderPlacementServiceSkeletonInterface {
    public OrderStatus placeOrder(ClientID clientID, OrderItem[] orderItem, Location location) {
        OrderStatus status = new OrderStatus();
        if (clientID.getClientID().equals("1"))
        {
            status.setStatus(StatusEnum.OK);
            OrderStatusChoice_type0 payload = new OrderStatusChoice_type0();
            payload.setOrderid("1234567890");
            status.setOrderStatusChoice_type0(payload);
        }
        if (clientID.getClientID().equals("2"))
        {
            status.setStatus(StatusEnum.UNSUCCESSFUL);
            OrderStatusChoice_type0 payload = new OrderStatusChoice_type0();
            OrderItem item = new OrderItem();
            item.setName("Chardonnay");
            item.setQty(6);
            payload.setMissingItem(new OrderItem[]{item});
            status.setOrderStatusChoice_type0(payload);
        }
        if (clientID.getClientID().equals("3"))
        {
            status.setStatus(StatusEnum.INVALID);
            OrderStatusChoice_type0 payload = new OrderStatusChoice_type0();
            payload.setBadItemReason(new String[]{"Wine 'Chardonna--y' could not be found"});
            status.setOrderStatusChoice_type0(payload);
        }
        return status;
    }
}
